import http from "@/utils/request";
// 1.6. 订单管理
//===============================================
// 1.6.1 创建订单 order/create
// 参数名	参数说明	备注
// address_id	收货地址id
// note	备注信息
// goods	购买商品信息数组,如：
//	[{"id":"109","count":5,"price":22},
//   {"id":"111","count":23,"price":33}]
export function createOrder(params) {
    return http.request({
        url: "order/create",
        method: "post",
        data: params,
    });
}

//===================================================
// 1.6.2 查询订单列表
// 参数名	参数说明	备注
// 无参数
export function getOrderList() {
    return http.request({
        url: "order/list",
        method: "get",
    });
}

export function getDeliveryList() {
    return http.request({
        url: "order/delivery",
        method: "get",
    });
}
//===================================================
// 1.6.3 查询订单详情 order/detail
// 参数名	参数说明	备注
// id	订单id
export function getOrderDetailById(params) {
    return http.request({
        url: "order/detail",
        method: "get",
        params,
    });
}

//===================================================
// 1.6.4 取消订单  order/cancel
// 参数名	参数说明	备注
// id	订单id
export function cancelOrderById(params) {
    return http.request({
        url: "order/cancel",
        method: "post",
        data: params,
    });
}


//===================================================
// 1.6.4 取消订单  order/cancel
// 参数名	参数说明	备注
// id	订单id
export function clearOrder() {
    return http.request({
        url: "order/clear",
        method: "post",
    });
}

export function orderPay(params) {
    return http.request({
        url: "order/pay",
        method: "post",
        data: params,
    });
}

export function delivery(params) {
    return http.request({
        url: "/order/delivery",
        method: "put",
        data:params
    });
}

export function receipt(params) {
    return http.request({
        url: "/order/receipt",
        method: "put",
        data:params
    });
}

export function undelivery() {
    return http.request({
        url: "/order/undelivery",
        method: "get",
    });
}
